//
//  ZhuShouThreeVC.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/9/13.
//  Copyright © 2017年 金橙云. All rights reserved.
//

#import "ZhuShouThreeVC.h"


#import "TodoHttpManager.h"
@interface ZhuShouThreeVC ()

@property(nonatomic,strong)UILabel *starTimeLab;

@property(nonatomic,strong)UILabel *zongQLab;
@property(nonatomic,strong)UILabel *danQLab;
@property(nonatomic,strong)UILabel *zheQLab;

@property(nonatomic,strong)UILabel *zongJLab;
@property(nonatomic,strong)UILabel *danJLab;
@property(nonatomic,strong)UILabel *zheJLab;


@property(nonatomic,strong)NSMutableDictionary *dataDic;



@end

@implementation ZhuShouThreeVC

-(void)viewDidAppear:(BOOL)animated
{
    //优惠查看
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didTDCeoCeYouLook:) name:TDCeoCeYouLook object:nil];
    
    [_manager setUPCeoShenPiYouHuiLookWIthZhuID:_allID withBUsnessID:nil];
}
// TODO:优惠查看
-(void)didTDCeoCeYouLook:(NSNotification *)notifi
{
    if (notifi.object != 0)
    {
        _dataDic = [notifi.object objectForKey:@"data"];
        _starTimeLab.text = [NSString stringWithFormat:@"开始执行时间 : %@",_dataDic[@"gotime"]];
       // NSLog(@"------主售信息   %@----",_dataDic);
       
        _zongQLab.text = [NSString stringWithFormat:@"总价优惠 : %@ 元",_dataDic[@"cash_one"]];
        _danQLab.text = [NSString stringWithFormat:@"单价优惠 : %@ 元/㎡",_dataDic[@"area_one"]];
        _zheQLab.text = [NSString stringWithFormat:@"折扣比例 : %@ %%",_dataDic[@"bili_one"]];
        
        
        _zongJLab.text = [NSString stringWithFormat:@"总价优惠 : %@ 元",_dataDic[@"cash_two"]];
        _danJLab.text = [NSString stringWithFormat:@"单价优惠 : %@ 元/㎡",_dataDic[@"area_two"]];
        _zheJLab.text = [NSString stringWithFormat:@"折扣比例 : %@ %%",_dataDic[@"bili_two"]];
    }
}
-(void)viewDidDisappear:(BOOL)animated
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:TDCeoCeYouLook object:nil];
}



- (void)viewDidLoad {
    [super viewDidLoad];
   self.title = @"优惠政策详情";
    self.view.backgroundColor = [UIColor whiteColor];
    
    _manager = [TodoHttpManager sharedManager];
    _dataDic = [NSMutableDictionary dictionary];
    [self setUPUI];
}


-(void)setUPUI
{
    for (int i = 0; i<8; i++)
    {
        UILabel *linLab = [[UILabel alloc] init];
        linLab.backgroundColor = [UIColor grayColor];
        linLab.frame = CGRectMake(0, 104+40*i, P_WIDTH, 0.5f);
        [self.view addSubview:linLab];
    }
    _starTimeLab = [[UILabel alloc] init];
    _starTimeLab.textColor = [UIColor blackColor];
    _starTimeLab.text= @"开始执行时间 : 2017-09-08";
    _starTimeLab.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:_starTimeLab];
    [_starTimeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(P_WIDTH-15, 20));
        make.top.equalTo(self.view.mas_top).offset(74);
        make.left.equalTo(self.view.mas_left).offset(15);
    }];
    
    UILabel *quanLab = [[UILabel alloc] init];
    quanLab.textColor = [UIColor orangeColor];
    quanLab.text= @"全款支付";
    quanLab.font = [UIFont systemFontOfSize:16];
    [self.view addSubview:quanLab];
    [quanLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(P_WIDTH-15, 20));
        make.top.equalTo(_starTimeLab.mas_bottom).offset(20);
        make.left.equalTo(self.view.mas_left).offset(15);
    }];

    _zongQLab =  [[UILabel alloc] init];
    _zongQLab.textColor = [UIColor blackColor];
    _zongQLab.text= @"总价优惠 : 2000元";
    _zongQLab.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:_zongQLab];
    [_zongQLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(P_WIDTH-15, 20));
        make.top.equalTo(quanLab.mas_bottom).offset(20);
        make.left.equalTo(self.view.mas_left).offset(15);
    }];

    
    _danQLab = [[UILabel alloc] init];
    _danQLab.textColor = [UIColor blackColor];
    _danQLab.text= @"单价优惠 : 元/㎡";
    _danQLab.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:_danQLab];
    [_danQLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(P_WIDTH-15, 20));
        make.top.equalTo(_zongQLab.mas_bottom).offset(20);
        make.left.equalTo(self.view.mas_left).offset(15);
    }];

    
    _zheQLab = [[UILabel alloc] init];
    _zheQLab.textColor = [UIColor blackColor];
    _zheQLab.text= @"折扣比例 : %";
    _zheQLab.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:_zheQLab];
    [_zheQLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(P_WIDTH-15, 20));
        make.top.equalTo(_danQLab.mas_bottom).offset(20);
        make.left.equalTo(self.view.mas_left).offset(15);
    }];

    
    UILabel * anLab = [[UILabel alloc] init];
    anLab.textColor = [UIColor orangeColor];
    anLab.text= @"按揭支付";
    anLab.font = [UIFont systemFontOfSize:16];
    [self.view addSubview:anLab];
    [anLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(P_WIDTH-15, 20));
        make.top.equalTo(_zheQLab.mas_bottom).offset(20);
        make.left.equalTo(self.view.mas_left).offset(15);
    }];

    
    _zongJLab = [[UILabel alloc] init];
    _zongJLab.textColor = [UIColor blackColor];
    _zongJLab.text= @"总价优惠 : 元";
    _zongJLab.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:_zongJLab];
    [_zongJLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(P_WIDTH-15, 20));
        make.top.equalTo(anLab.mas_bottom).offset(20);
        make.left.equalTo(self.view.mas_left).offset(15);
    }];

    
    _danJLab = [[UILabel alloc] init];
    _danJLab.textColor = [UIColor blackColor];
    _danJLab.text= @"单价优惠 : 元";
    _danJLab.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:_danJLab];
    [_danJLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(P_WIDTH-15, 20));
        make.top.equalTo(_zongJLab.mas_bottom).offset(20);
        make.left.equalTo(self.view.mas_left).offset(15);
    }];
    

    _zheJLab = [[UILabel alloc] init];
    _zheJLab.textColor = [UIColor blackColor];
    _zheJLab.text= @"折扣比例 : %";
    _zheJLab.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:_zheJLab];
    [_zheJLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(P_WIDTH-15, 20));
        make.top.equalTo(_danJLab.mas_bottom).offset(20);
        make.left.equalTo(self.view.mas_left).offset(15);
    }];
    

    
    
    
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
